package com.seafwg.config;

import com.seafwg.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author seafwg
 * @Date 2022/3/23 10:55 上午
 * @Version 1.0
 * @description xxx
 */
@Configuration
public class ServletConfig {
    /**
     * 注入自定义的servlet
     * @return
     */
    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        ServletRegistrationBean<MyServlet> regMyServlet = new ServletRegistrationBean<>();
        regMyServlet.setServlet(new MyServlet());
        regMyServlet.addUrlMappings("/myservlet");

        return regMyServlet;
    }
}
